package cn.net.shuxing.yifu.mysiteforme.admin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;

@Controller
public class PageController {

    @GetMapping("/{path}")
    public String toPath(@PathVariable("path") String path)
    {

        return path;
    }

    @GetMapping("/")
    public String toIndex()
    {

        return "index";
    }

    @GetMapping("/**/{?:^[^\\.]*$}")
    public String toPage(HttpServletRequest request)
    {
        String url = request.getRequestURL().toString();
        url = url.substring("http://".length());
        url = url.substring(url.indexOf("/"));
        return url;
    }
}
